import COS from "cos-js-sdk-v5";
const cos = new COS({
  SecretId: "AKIDhK6oW96L8mJbKvreiZCpXIw6h973lBKH",
  SecretKey: "rWzJROAlA5mNsBJH2auyxqYi2EAvYYMw",
});
const bucket = "bdw-sh-1259268558";
export function uploadFile(file, filename) {
  return new Promise((resolve, reject) => {
    cos.putObject(
      {
        Bucket: bucket,
        Region: "ap-shanghai",
        Key: filename,
        Body: file,
      },
      (err, data) => {
        if (err) {
          reject(err);
        } else {
          resolve(data);
        }
      }
    );
  });
}
